package com.spring.lesson001.demo12.proxyTime;

import com.spring.lesson001.demo12.IService;
import com.spring.lesson001.demo12.ServiceA;
import com.spring.lesson001.demo12.ServiceB;
import org.junit.Test;

/**
 * @author vhans
 */
public class costTimeProxy {
    @Test
    public void test() {
        IService serviceA = CostTimeInvocationHandler.createProxy(new ServiceA(), IService.class);
        IService serviceB = CostTimeInvocationHandler.createProxy(new ServiceB(), IService.class);

        serviceA.m1();
        serviceA.m2();
        serviceA.m3();

        serviceB.m1();
        serviceB.m2();
        serviceB.m3();
    }

    @Test
    public void testUser() {
        IUserService userService = CostTimeInvocationHandler.createProxy(new UserService(), IUserService.class);
        userService.insert("Vhans");
    }
}
